﻿using AutoMapper;
using MD5Hash;
using MediatR;
using Microsoft.IdentityModel.Tokens;
using RBAC.ApiReads.Application.Command;
using RBAC.ApiReads.DTO;
using RBAC.Domain.RbacEntity;
using RBAC.Infrasturcture.Interfaces;
using RBAC.ResultCode;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;

namespace RBAC.ApiReads.Application.Commandhandler
{
    public class GetFunctionCommandhandler : IRequestHandler<GetFunctionCommand, ApiResult<List<Function>>>
    {
        private readonly IBaseRepository<Function> functionrepository;

        public GetFunctionCommandhandler(IBaseRepository<Function> functionrepository)
        {
            this.functionrepository = functionrepository;
        }
        public async Task<ApiResult<List<Function>>> Handle(GetFunctionCommand request, CancellationToken cancellationToken)
        {
            var info = functionrepository.GetAll().ToList();


            return new ApiResult<List<Function>>
            { 
             Code=ApiResultEnum.查询成功,
             Message=ApiResultEnum.查询成功.ToString(),
             Data= info
            };







          
        }


    }
}
